package com.compound;

public class DuckSimulator3 {

	public static void main(String[] args) {
		DuckSimulator3 simulator3 = new DuckSimulator3();
		simulator3.simulate();
	}

	void simulate() {
		Quackable mallardDuck = new QuackCounter(new MallardDuck());
		Quackable redheadDuck = new QuackCounter(new RedheadDuck());
		Quackable duckCall = new QuackCounter(new DuckCall());
		Quackable rubberDuck = new QuackCounter(new RubberDuck());

		// Goose Adapter
		// Take the goose as a duck
		Quackable gooseDuck = new GooseAdapter(new Goose());

		System.out.println("\nDuck Simulator");

		simulate(mallardDuck);
		simulate(redheadDuck);
		simulate(duckCall);
		simulate(rubberDuck);
		simulate(gooseDuck);

		System.out.println("The ducks quacked " + QuackCounter.getQuacks()
				+ " times");
	}

	void simulate(Quackable duck) {
		duck.quack();
	}

}
